Skip to content

Add interface to allow customize of operator deployments#1519

Merged
openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
stuggi:operator_resources_no_webhook
Jul 9, 2025
Merged

Add interface to allow customize of operator deployments#1519
openshift-merge-bot[bot] merged 1 commit into
openstack-k8s-operators:mainfrom
stuggi:operator_resources_no_webhook

Conversation

@stuggi

@stuggi stuggi commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

Adds an interface which allows to customize the following parameters of a controller-manager operator deployment

  • change the replica (0/1)
  • change the resources (requests/limits) of the manager container

It keeps the current default resource requests as is. For easier gotemplate it this adds an internal custom struct type, which allows to just loop over a list of operator.Operator for service operators and a dedicated instance for the openstack-operator-controller-manager and the rabbitmq-cluster-operator-manager.

E.g. changing the default cpu limits for the infra operator and disabling the openstack-baremetal operator would be:

...
spec:
  operatorOverrides:
  - name: infra
    controllerManager:
      resources:
        limits:
          cpu: 600m
          memory: 2Gi
    replicas: 1
  - name: openstack-baremetal
    replicas: 0

To add a new service operator has the following high level steps:

  • in the openstack_types.go api
    • add a new const with the name
    • add an entry for the defaults in the OperatorList var
    • add the name also to the Enum of the OperatorSpec.Name
  • (optional) if any specific env var need be passed to the operator, e.g. related images list, or enable webhooks, check the applyOperator() in the openstack_controller.go .

Jira: OSPRH-17785

@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/eac61facff9d483c97892f6e1d86e681

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 12m 59s
podified-multinode-edpm-deployment-crc FAILURE in 33m 26s
cifmw-crc-podified-edpm-baremetal FAILURE in 48m 45s
adoption-standalone-to-crc-ceph-provider RETRY_LIMIT in 3m 16s
openstack-operator-tempest-multinode FAILURE in 38m 36s

@stuggi stuggi force-pushed the operator_resources_no_webhook branch 2 times, most recently from 56f634e to 2971009 Compare July 4, 2025 10:05

@ratailor ratailor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor nits.

Comment thread apis/operator/v1beta1/openstack_types.go Outdated
Comment thread controllers/operator/openstack_controller.go Outdated
Comment thread pkg/operator/override.go Outdated
@stuggi stuggi force-pushed the operator_resources_no_webhook branch from 2971009 to 7ca4282 Compare July 7, 2025 08:28
@stuggi

stuggi commented Jul 7, 2025

Copy link
Copy Markdown
Contributor Author

/retest

@stuggi stuggi requested review from dprince and olliewalsh and removed request for jpodivin July 7, 2025 15:27
Comment thread apis/operator/v1beta1/openstack_types.go Outdated
Adds an interface which allows to customize the following
parameters of a controller-manager operator deployment
- change the replica (0/1)
- change the resources (requests/limits) of the manager container

It keeps the current default resource requests as is. For easier
gotemplate it this adds an internal custom struct type, which allows
to just loop over a list of operator.Operator for service operators
and a dedicated instance for the openstack-operator-controller-manager
and the rabbitmq-cluster-operator-manager.

E.g. changing the default cpu limits for the infra operator and
disabling the openstack-baremetal operator would be:
~~~
...
spec:
  operatorOverrides:
  - name: infra
    controllerManager:
      resources:
        limits:
          cpu: 600m
          memory: 2Gi
    replicas: 1
  - name: openstack-baremetal
    replicas: 0
~~~

To add a new service operator has the following high level steps:
- in the openstack_types.go api
  - add a new const with the name
  - add an entry for the defaults in the OperatorList var
  - add the name also to the Enum of the OperatorSpec.Name
- (optional) if any specific env var need be passed to the operator,
  e.g. related images list, or to enable webhooks, check the
  applyOperator() in the openstack_controller.go .

Jira: OSPRH-17785

Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
@stuggi stuggi force-pushed the operator_resources_no_webhook branch from 7ca4282 to ebdead0 Compare July 9, 2025 05:55
@softwarefactory-project-zuul

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/b0b65590bc344a2095c2711ae15cbf52

✔️ openstack-k8s-operators-content-provider SUCCESS in 3h 14m 03s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 10m 13s
cifmw-crc-podified-edpm-baremetal RETRY_LIMIT in 16m 32s
✔️ adoption-standalone-to-crc-ceph-provider SUCCESS in 2h 58m 16s
✔️ openstack-operator-tempest-multinode SUCCESS in 1h 34m 57s

@stuggi

stuggi commented Jul 9, 2025

Copy link
Copy Markdown
Contributor Author

recheck

@openshift-ci openshift-ci Bot added the lgtm label Jul 9, 2025
@openshift-ci

openshift-ci Bot commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprince, stuggi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot Bot merged commit ce77ffb into openstack-k8s-operators:main Jul 9, 2025
9 checks passed
@stuggi

stuggi commented Jul 9, 2025

Copy link
Copy Markdown
Contributor Author

/cherry-pick 18.0-fr3

@openshift-cherrypick-robot

Copy link
Copy Markdown

@stuggi: new pull request created: #1526

Details

In response to this:

/cherry-pick 18.0-fr3

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

karelyatin added a commit to karelyatin/ovn-operator that referenced this pull request Apr 8, 2026
With [1] we can avoid disabling openstack init operator
and just scale down the operators as needed, let's use
it with run with webhook.

[1] openstack-k8s-operators/openstack-operator#1519

Signed-off-by: Yatin Karel <ykarel@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants